fix(tests): restore test-module imports broken by recent refactors#4759
Conversation
The lib-test target fails to compile on main (38 errors: E0405/E0425/E0432/ E0433), so the Rust Core Coverage CI lane is red — which blocks the coverage gate on every open PR. Recent refactors (config schema tinyhumansai#4720, web chat rework tinyhumansai#4722, orchestration tinyhumansai#4738) moved helpers into submodules or dropped the re-exports the test modules rely on, without updating the tests. Restore the missing imports/re-exports so the test target compiles again. No test logic or production behaviour changes: - channels/providers/web: re-export the 13 field/session/type/error helpers web_tests.rs pulls via use super::{..} (the 'Schema field helpers' block was left empty by tinyhumansai#4722). - config/schemas: re-export schema_defs::schemas for schemas_tests.rs. - config/schema/load, mcp_server/tools, memory/schema, inference/provider, inference/.../ollama_admin: qualify each test import to the submodule that now owns the symbol. - memory/chat: import DEFAULT_CLOUD_LLM_MODEL from config::schema.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR adds test/debug-only re-exports and missing test imports across several Rust modules, and introduces three new memory schema tests covering namespace consistency, error output shape, and ingest field requirements. ChangesTest/debug support and schema validation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
…dules Second layer of the lib-test compile drift, previously masked behind the first batch: sandbox/docker.rs tests use DockerOverrides (sandbox::types) and memory/tree_source/file.rs tests use TreeKind/TreeStatus (memory_store::trees::types) without importing them.
Summary
Rust Core Coveragelane onmain— the crate's lib-test target currently fails to compile (38 errors:E0405/E0425/E0432/E0433), soRust Core Coveragefails onmainHEAD and, via the PR merge-ref, on every open PR's coverage gate.pub(crate) usere-exports the tests rely on) without updating the test modules.Problem
cargo llvm-cov ... -p openhuman --libcompiles the whole lib-test target, which no longer builds onmain. The 38 errors cluster into 8 modules whose*_tests.rsreference symbols that still exist but are no longer in the test module's scope:channels/providers/webWebChatParams,required_string,optional_bool/f64/string/u64,json_output,compose_system_prompt_suffix,normalize_model_override,locale_reply_directive,provider_role_for_model_override,inference_budget_exceeded_user_message,is_inference_budget_exceeded_error(13)web/{schemas,session,types}.rs+web_errors.rs; the// Schema field helpers re-exported for testsblock inweb/mod.rswas left emptyconfig/schemasschemas(×4)schema_defs.rs, not re-exported into theschemastest scopeconfig/schema/loadEnvLookup,ACTION_DIR_ENV_VAR,MEMORY_SYNC_INTERVAL_SECS_ENV_VARload/{env,dirs}.rssubmodulesinference/providerStreamErrorprovider/traits.rsmcp_server/toolslist_tools_result_for_configtools/specs.rsmemory/schemaNAMESPACEschema/definitions.rsmemory/chatDEFAULT_CLOUD_LLM_MODELconfig::schemainference/.../ollama_admininterrupted_pull_settle_window_secsollama_admin/util.rsIntroduced by #4720 / #4722 / #4738.
clippydoesn't catch it (cargo clippy -p openhumanskips test targets), so it only surfaces in the coverage lane — which is why it slipped ontomain.Solution
Restore the missing scope, matching each module's existing pattern:
pub(crate) usethe 13 helpers fromschemas/session/types/web_errors, gated#[cfg(any(test, debug_assertions))]with#[allow(unused_imports)](identical to the adjacentweb_errorsre-export block).#[cfg(test)] use schema_defs::schemas;alongside the existing test re-exports.*_tests.rs— qualify each import to the submodule that now owns the symbol (e.g.use super::env::EnvLookup;,use super::specs::list_tools_result_for_config;).No test bodies were changed; no tests removed.
Submission Checklist
Rust Core Coveragelane going green is the verification.use/re-export statements (non-executable), excluded bydiff-cover.main+ the open PR queue.Impact
Rust Core Coverageonmain, unblocking the coverage gate for all open PRs (immediately relevant to fix(prompts): frame MEMORY.md as background so fresh threads don't fake prior-chat continuity #4748, fix(agent): arm harness wall-clock ceiling so a wedged turn can't ship an empty reply #4751, fix(agent): route "list my threads" to direct thread_list, not the memory sub-agent (#4744) #4752, whose own checks are already green).Related
AI Authored PR Metadata
Commit & Branch
fix/lib-test-compile-driftmainValidation Run
pnpm --filter openhuman-app format:check— N/A: Rust-only changepnpm typecheck— N/A: Rust-only changeRust Core Coveragelane compiling the lib-test targetValidation Blocked
command:cargo test -p openhuman --lib/cargo llvm-coverror:local builds are disabled on this worker (disk pressure); the fix is verified by inspection (every restored symbol's definition location is cited above) and by CI.impact:low — re-export / import statements only; each restored name resolves to a confirmedpub/pub(crate)definition in the cited submodule.Behavior Changes
Parity Contract
#[cfg(test)]/#[cfg(any(test, debug_assertions))]re-exports.Summary by CodeRabbit